var e, t = getApp(), a = require("../../../utils/util.js");

Page({
    data: {},
    onLoad: function(t) {
        e = this, t.serviceOrderId ? e.setData({
            serviceOrderId: t.serviceOrderId
        }) : e.getcardHistory();
    },
    getShareUsrInfo: function() {
        var o = t.globalData.token;
        a.request(t, "wx/mkt/getSomeBodySend", "GET", {
            token: o,
            addId: e.data.addId
        }, function(t) {
            t.state && e.setData({
                nickName: t.data.nickName
            });
        });
    },
    searchCoupons: function() {
        wx.redirectTo({
            url: "/pages/info/coupons/index"
        });
    },
    getShareCoupons: function() {
        wx.removeStorageSync("serviceOrderId");
        var o = t.globalData.custId, r = t.globalData.token;
        a.request(t, "wx/mkt/autoCouponTofriend", "GET", {
            token: r,
            serviceOrderId: e.data.serviceOrderId,
            custId: o
        }, function(e) {
            e.state ? (wx.showToast({
                title: "领取成功"
            }), setTimeout(function() {
                wx.switchTab({
                    url: "/pages/home/home"
                });
            }, 2e3)) : wx.showToast({
                title: e.message,
                icon: "none"
            });
        });
    }
});